package com.xq.service.tesk;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.xq.service.IdentityService;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Callable;

public class UploadTask implements Callable<Map<String,String>> {

    private byte[] liveImage;
    private byte[] frontImage;
    private byte[] backImage;
    private IdentityService identityService;

    public UploadTask(byte[] liveImage,byte[] frontImage, byte[] backImage, IdentityService identityService){
        this.liveImage=liveImage;
        this.frontImage=frontImage;
        this.backImage=backImage;
        this.identityService=identityService;
    }

    @Override
    public Map<String,String> call() throws Exception {

        //上传到文件服务器
        Thread.sleep(2000);
        //存上传成功后的路径
        Map<String,String> map = new HashMap<>();
        //正面
        map.put("frontImageUrl","http://127.0.0.1:8081/"+ UUID.randomUUID()+".jpg");
        //反面
        map.put("backImageUrl","http://127.0.0.1:8081/"+ UUID.randomUUID()+".jpg");
        //活体照片
        map.put("liveImageUrl","http://127.0.0.1:8081/"+ UUID.randomUUID()+".jpg");
        return map;
    }
}
